<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "categories".
 *
 * @property string $id
 * @property string $class 类别
 * @property string $key
 * @property string $value
 * @property int $order 排序
 */
class CategoriesDjr extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'categories';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('forge');
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['class', 'key', 'value', 'order'], 'required'],
            [['order'], 'integer'],
            [['class', 'key', 'value'], 'string', 'max' => 255],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'class' => '类别',
            'key' => 'Key',
            'value' => 'Value',
            'order' => '排序',
        ];
    }

    /**
     * {@inheritdoc}
     * @return CategoriesDjrQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new CategoriesDjrQuery(get_called_class());
    }
}
